<?php

namespace app\libs;

use wicked\core\Forge;

class Tree
{

    public static function display($person)
    {
        if($relation = $person->relation())
            static::relation($relation);
        else
            static::person($person);
    }

    public static function person($person, $primary = true)
    {
        Forge::block('tree/person', compact('person', 'primary'));
    }

    public static function relation($relation)
    {
        Forge::block('tree/relation', compact('relation', 'stop'));
    }

    public static function children($children)
    {
        if(count($children) > 0)
            Forge::block('tree/children', compact('children'));
    }

}
